package cn.wolfcode.p2p.base.domain;

import cn.wolfcode.base.BaseDomain;
import java.math.BigDecimal;

import cn.wolfcode.p2p.base.util.BidConst;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 *    
 *    账户信息
 *    @author 
 *    @since 2018-11-24 13:14:09
 */
@Getter@Setter
@Accessors(chain = true)
public class Account extends BaseDomain {
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
     * 乐观锁
     */
    private Integer version = 0;

    /**
     * 交易密码
     */
    private String tradePassword;

    /**
     * 可用金额
     */
    private BigDecimal usableAmount = BidConst.ZERO;

    /**
     * 冻结金额
     */
    private BigDecimal freezedAmount = BidConst.ZERO;

    /**
     * 代收利息
     */
    private BigDecimal unReceiveInterest  = BidConst.ZERO;

    /**
     * 代收本金
     */
    private BigDecimal unReceivePrincipal  = BidConst.ZERO;

    /**
     * 代还本息(本金+利息)
     */
    private BigDecimal unReturnAmount  = BidConst.ZERO;

    /**
     * 最大授信额度
     */
    private BigDecimal borrowLimitAmount = BidConst.DEFAULT_BORROW_LIMIT;

    /**
     * 剩余授信额度
     */
    private BigDecimal remainBorrowLimit = BidConst.DEFAULT_BORROW_LIMIT;

    /**
     * 总余额 = 可用金额 + 冻结金额 + 代收本金
     */
    public BigDecimal getTotalAmount(){

        return usableAmount.add(freezedAmount).add(unReceivePrincipal);
    }

}